﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using University.Workshop.Model;
using University.Workshop.DataAccess;


namespace University.Workshop.WinApp
{
    public partial class ClientRegister :TemplateForm
    {
        public ClientRegister()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string fullname = string.Empty;
            string id = string.Empty;
            string telephone = string.Empty;

            string organizacion = string.Empty;
            string celular = string.Empty;
            string email = string.Empty;
            string fechaNacimiento = string.Empty;
            string fax = string.Empty;
            string pais = string.Empty;
            string sexo = string.Empty;

            fullname = textBoxName.Text;
            id = textBoxId.Text;
            telephone = textBoxTelephone.Text;

            organizacion = textBoxOrganizacion.Text;
            celular = textBoxCelular.Text;
            email = textBoxEmail.Text;
            fechaNacimiento = textBoxFechaNacimiento.Text;
            fax = textBoxFax.Text;
            pais = textBoxPais.Text;
            sexo = comboBoxSexo.Text;

            try
            {
                ClientRegistration.AddClient(fullname, id, telephone, organizacion, celular, email, fechaNacimiento, fax, pais, sexo);
                MessageBox.Show("Register Complete");
            }
            catch(Exception ex) {
                MessageBox.Show(ex.Message);
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBoxName.Text = null;
            textBoxId.Text = null;
            textBoxTelephone.Text = null;

            textBoxOrganizacion.Text = null;
            textBoxCelular.Text = null;
            textBoxEmail.Text = null;
            textBoxFechaNacimiento.Text = null;
            textBoxFax.Text = null;
            textBoxPais.Text = null;
            comboBoxSexo.Text = null;
        }

        private void buttonCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void labelFullName_Click(object sender, EventArgs e)
        {

        }
    }
}
